package day240607.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Vector;
import java.util.concurrent.ConcurrentLinkedQueue;

public class TicketWindows1 {
    //一个车站有10个窗口对外售卖1000张车票
    static Queue<String> tickets=new ConcurrentLinkedQueue<>();
    static {
        for (int i = 0; i <1000 ; i++) {
            tickets.add("车票编码----"+i);
        }
    }
    public static void main(String[] args) {
        for (int i = 0; i <10 ; i++) {
            new Thread(() -> {
                while (true){
                    String s= tickets.poll();
                    if (s==null){break;}
                    else System.out.println("售出==="+s);
                }

            }).start();

        }
    }
}
